﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PServiceBus.MessageProxy;
using PServiceBus.Transports;

namespace Starbucks.Messages {
    
    [ESBProxyService]
    public interface IStarbuckService {

        [ESBRequest(typeof(DrinkPrepared), isRequestClass: true)]
        void SendDrinkPrepared(DrinkPrepared msg);

        [ESBRequest(typeof(DrinkReady), isRequestClass: true)]
        void SendDrinkReady(DrinkReady msg);

        [ESBRequest(typeof(DrinkPayment), isRequestClass: true)]
        void SendDrinkPayment(DrinkPayment msg);

        [ESBRequest(typeof(DrinkPaymentMade), isRequestClass: true)]
        void SendDrinkPaymentMade(DrinkPaymentMade msg);

        [ESBRequest(typeof(NewDrinkOrder), isRequestClass: true)]
        void SendNewDrinkOrder(NewDrinkOrder msg);

        [ESBRequest(typeof(DrinkPaymentProcessed), isRequestClass: true)]
        void SendDrinkPaymentProcessed(DrinkPaymentProcessed msg);

        [ESBRequest(typeof(NewDrinkOrderAccepted), isRequestClass: true)]
        void SendNewDrinkOrderAccepted(NewDrinkOrderAccepted msg);

        [ESBRequest(typeof(PrepareDrink), isRequestClass: true)]
        void SendPrepareDrink(PrepareDrink msg);

        [ESBTransport(typeof(TcpTransport))]
        [ESBTransportParam("Port", "1111")]
        [ESBTransportParam("IPAddress", "127.0.0.1")]
        [ESBListener(typeof(PrepareDrink))]
        void ReceivePrepareDrink(Action<PrepareDrink> action, Func<Exception, bool> error);

        [ESBTransport(typeof(TcpTransport))]
        [ESBTransportParam("Port", "2222")]
        [ESBTransportParam("IPAddress", "127.0.0.1")]
        [ESBListener(typeof(NewDrinkOrder))]
        void ReceiveNewDrinkOrder(Action<NewDrinkOrder> action, Func<Exception, bool> error);

        [ESBTransport(typeof(TcpTransport))]
        [ESBTransportParam("Port", "3333")]
        [ESBTransportParam("IPAddress", "127.0.0.1")]
        [ESBListener(typeof(DrinkReady))]
        void ReceiveDrinkReady(Action<DrinkReady> action, Func<Exception, bool> error);

        [ESBTransport(typeof(TcpTransport))]
        [ESBTransportParam("Port", "4444")]
        [ESBTransportParam("IPAddress", "127.0.0.1")]
        [ESBListener(typeof(DrinkPayment))]
        void ReceiveDrinkPayment(Action<DrinkPayment> action, Func<Exception, bool> error);

        [ESBTransport(typeof(TcpTransport))]
        [ESBTransportParam("Port", "5555")]
        [ESBTransportParam("IPAddress", "127.0.0.1")]
        [ESBListener(typeof(DrinkPaymentMade))]
        void ReceiveDrinkPaymentMade(Action<DrinkPaymentMade> action, Func<Exception, bool> error);

        [ESBTransport(typeof(TcpTransport))]
        [ESBTransportParam("Port", "6666")]
        [ESBTransportParam("IPAddress", "127.0.0.1")]
        [ESBListener(typeof(NewDrinkOrderAccepted))]
        void ReceiveNewDrinkOrderAccepted(Action<NewDrinkOrderAccepted> action, Func<Exception, bool> error);

        [ESBTransport(typeof(TcpTransport))]
        [ESBTransportParam("Port", "7777")]
        [ESBTransportParam("IPAddress", "127.0.0.1")]
        [ESBListener(typeof(DrinkPaymentProcessed))]
        void ReceiveDrinkPaymentProcessed(Action<DrinkPaymentProcessed> action, Func<Exception, bool> error);
    }
}
